package com.powernode.feign.fallbackfactory;

import com.powernode.domain.Basket;
import com.powernode.feign.OrderBasketFeign;
import com.powernode.model.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @create: 2024/7/25
 * @author: gyhe10
 * @description:
 **/

@Component
@Slf4j
public class OrderBasketFeignFallbackFactory implements FallbackFactory<OrderBasketFeign> {
    @Override
    public OrderBasketFeign create(Throwable cause) {
        return new OrderBasketFeign() {
            @Override
            public Result<List<Basket>> getBasketListByIds(List<Long> basketIdList) {
                log.error("调用购物车服务中根据购物车记录id集合查询购物车记录对象集合的接口失败，原因：{}", cause.getMessage());
                return null;
            }

            @Override
            public Result<Boolean> removeBasketByOpenIdAndSkuIds(Map<String, Object> param) {
                log.error("调用购物车服务中根据会员id和skuId集合删除购物车记录的接口失败，原因：{}", cause.getMessage());
                return null;
            }
        };
    }
}
